package com.sunbird.crm.contorller;

import com.sunbird.crm.base.Vo.RestMessage;
import com.sunbird.crm.base.aspect.AopLog;
import com.sunbird.crm.base.contorller.BaseContorller;
import com.sunbird.crm.entity.sys.TUser;
import com.sunbird.crm.servce.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @ClassName LoginConterllor
 * @Descriptiom 登陆
 * @Author Sunbird
 * @Date 2019/8/28 17:36
 * @Version 1.0
 **/

@Controller
@RequestMapping("admin")
public class LoginConterllor extends BaseContorller {

    @Autowired
    private LoginService loginService;

    @RequestMapping("login")
    @ResponseBody
    public RestMessage login(HttpServletRequest request, HttpServletResponse response, TUser user){
        return  loginService.login(user);
    }
    @AopLog("用户登出")
   @RequestMapping("outLogin")
    public  RestMessage outLogin(){
        return  loginService.logout();
   }
}
